/*
 * Copyright (C) 2015 The Gravitee team (http://gravitee.io)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import { PolicyPlugin } from './policyPlugin';

export function fakePolicyPlugin(modifier?: Partial<PolicyPlugin>): PolicyPlugin {
  const base: PolicyPlugin = {
    id: 'test-policy',
    name: 'Test policy',
    description: 'Test policy description',
    category: 'test',
    message: ['REQUEST', 'RESPONSE', 'MESSAGE_REQUEST', 'MESSAGE_RESPONSE'],
    proxy: ['REQUEST', 'RESPONSE'],
  };

  return {
    ...base,
    ...modifier,
  };
}

export function fakePoliciesPlugin(): PolicyPlugin[] {
  return [
    {
      id: 'xslt',
      name: 'XSLT Transformation',
      description: 'Description of the XSLT Gravitee Policy',
      icon: '',
      category: 'transformation',
      version: '2.0.0',
      proxy: [],
      message: [],
    },
    {
      id: 'traffic-shadowing',
      name: 'Traffic Shadowing',
      description: 'Description of the Traffic Shadowing Gravitee Policy',
      icon: '',
      category: 'others',
      version: '2.0.0',
      proxy: [],
      message: [],
    },
    {
      id: 'rate-limit',
      name: 'Rate Limit',
      description: 'Description of the Rate Limit Gravitee Policy',
      icon: '',
      category: 'others',
      version: '2.0.1',
      proxy: [],
      message: [],
    },
    {
      id: 'xml-validation',
      name: 'XML Validation',
      description: 'Description of the XML validation Policy',
      icon: '',
      category: 'others',
      version: '1.1.0',
      proxy: [],
      message: [],
    },
    {
      id: 'rbac',
      name: 'Role Based Access Control',
      description: 'Description of the RBAC Gravitee Policy',
      icon: '',
      category: 'security',
      version: '1.1.0',
      proxy: [],
      message: [],
    },
    {
      id: 'policy-data-logging-masking',
      name: 'Data Logging Masking',
      description: 'Description of the Data Logging Masking Gravitee Policy',
      icon: '',
      category: 'others',
      version: '2.0.3',
      proxy: [],
      message: [],
    },
    {
      id: 'aws-lambda',
      name: 'AWS Lambda',
      description: 'Description of the AWS Lambda Gravitee Policy',
      icon: '',
      category: 'others',
      version: '1.1.0',
      proxy: [],
      message: [],
    },
    {
      id: 'ip-filtering',
      name: 'IPFiltering',
      description: 'Filter IPs from remote address or X-Forwarded-For header with blacklist or whitelist',
      icon: '',
      category: 'security',
      version: '1.9.0',
      proxy: [],
      message: [],
    },
    {
      id: 'policy-assign-content',
      name: 'Assign content',
      description: 'Description of the Assign content Policy',
      icon: '',
      category: 'transformation',
      version: '1.7.0',
      proxy: [],
      message: [],
    },
    {
      id: 'xml-json',
      name: 'XML to JSON',
      description: 'Description of the XML to JSON Transformation  Gravitee Policy',
      icon: '',
      category: 'transformation',
      version: '1.8.3',
      proxy: [],
      message: [],
    },
    {
      id: 'policy-override-request-method',
      name: 'Override HTTP Method',
      description: 'Description of the override HTTP request method Gravitee Policy',
      icon: '',
      category: 'transformation',
      version: '2.0.0',
      proxy: [],
      message: [],
    },
    {
      id: 'key-less',
      name: 'Keyless',
      description: 'Description of the Keyless Security Gravitee Policy',
      icon: '',
      category: 'security',
      version: '2.2.0',
      proxy: ['REQUEST'],
      message: ['REQUEST'],
    },
    {
      id: 'policy-geoip-filtering',
      name: 'GeoIP Filtering',
      description: 'Description of the GeoIP Filtering Gravitee Policy',
      category: 'security',
      version: '1.1.1',
      proxy: [],
      message: [],
    },
    {
      id: 'http-signature',
      name: 'HTTP Signature',
      description: 'Description of the HTTP Signature Gravitee Policy',
      icon: '',
      category: 'security',
      version: '1.5.0',
      proxy: [],
      message: [],
    },
    {
      id: 'policy-assign-attributes',
      name: 'Assign attributes',
      description: 'Description of the Assign attributes Policy',
      icon: '',
      category: 'transformation',
      version: '1.5.1',
      proxy: [],
      message: [],
    },
    {
      id: 'latency',
      name: 'Latency',
      description: 'Description of the Latency Gravitee Policy',
      icon: '',
      category: 'others',
      version: '1.4.0',
      proxy: [],
      message: [],
    },
    {
      id: 'json-threat-protection',
      name: 'JSON Threat Protection',
      description: 'Description of the JsonThreatProtection Gravitee Policy',
      icon: '',
      category: 'security',
      version: '1.3.3',
      proxy: [],
      message: [],
    },
    {
      id: 'javascript',
      name: 'Javascript',
      description: 'Description of the Javascript Gravitee Policy',
      icon: '',
      category: 'others',
      version: '1.2.0',
      proxy: [],
      message: [],
    },
    {
      id: 'xml-threat-protection',
      name: 'XML Threat Protection',
      description: 'Protects against main XML threats',
      icon: '',
      category: 'security',
      version: '1.3.2',
      proxy: [],
      message: [],
    },
    {
      id: 'message-filtering',
      name: 'Message Filtering',
      description: 'Message Filtering Gravitee Policy',
      category: 'others',
      version: '1.1.1',
      proxy: [],
      message: ['MESSAGE_RESPONSE', 'MESSAGE_REQUEST'],
    },
    {
      id: 'policy-basic-authentication',
      name: 'Basic Authentication',
      description: 'Description of the Basic Authentication Gravitee Policy',
      category: 'security',
      version: '1.4.1',
      proxy: [],
      message: [],
    },
    {
      id: 'policy-generate-jwt',
      name: 'Generate JWT',
      description: 'Description of the Generate JWT Gravitee Policy',
      icon: '',
      category: 'security',
      version: '1.5.0',
      proxy: [],
      message: [],
    },
    {
      id: 'spike-arrest',
      name: 'Spike Arrest',
      description: 'The Spike Arrest Policy allows to limit the requests received by a backend',
      icon: '',
      category: 'others',
      version: '2.0.1',
      proxy: [],
      message: [],
    },
    {
      id: 'avro-json',
      name: 'Avro JSON Transformation',
      description: 'Policy used to transform Avro to JSON',
      icon: '',
      category: 'transformation',
      version: '1.2.0-alpha.2',
      proxy: ['RESPONSE', 'REQUEST'],
      message: ['MESSAGE_RESPONSE', 'MESSAGE_REQUEST'],
    },
    {
      id: 'cache',
      name: 'Cache',
      description: 'Description of the Cache Gravitee Policy',
      icon: '',
      category: 'performance',
      version: '1.16.0',
      proxy: [],
      message: [],
    },
    {
      id: 'rest-to-soap',
      name: 'Rest to SOAP Transformer',
      description: 'Description of the Rest to SOAP Transformer Policy',
      icon: '',
      category: 'transformation',
      version: '1.13.0',
      proxy: [],
      message: [],
    },
    {
      id: 'dynamic-routing',
      name: 'Dynamic Routing',
      description: 'Description of the Dynamic Routing Gravitee Policy',
      icon: '',
      category: 'others',
      version: '1.11.1',
      proxy: [],
      message: [],
    },
    {
      id: 'request-content-limit',
      name: 'Request Content Limit',
      description: 'Description of the Request Content Limit Gravitee Policy',
      icon: '',
      category: 'others',
      version: '1.8.0',
      proxy: [],
      message: [],
    },
    {
      id: 'policy-http-callout',
      name: 'HTTP Callout',
      description: 'Description of the CalloutHttp Gravitee Policy',
      icon: '',
      category: 'others',
      version: '2.0.1',
      proxy: [],
      message: [],
    },
    {
      id: 'policy-circuit-breaker',
      name: 'Circuit Breaker',
      description: 'Description of the Circuit Breaker Gravitee Policy',
      category: 'others',
      version: '1.1.4',
      proxy: [],
      message: [],
    },
    {
      id: 'oauth2',
      name: 'OAuth2',
      description: 'Description of the OAuth2 Gravitee Policy',
      icon: '',
      category: 'security',
      version: '2.2.0',
      proxy: ['REQUEST'],
      message: ['REQUEST'],
    },
    {
      id: 'html-json',
      name: 'HTML to JSON',
      description: 'The HTML to JSON Transformation Gravitee Policy allows to get a json by parsing an html content',
      icon: '',
      category: 'transformation',
      version: '1.6.0',
      proxy: [],
      message: [],
    },
    {
      id: 'json-validation',
      name: 'JSON Validation',
      description: 'Description of the Json Validation Gravitee Policy',
      icon: '',
      category: 'others',
      version: '1.6.1',
      proxy: [],
      message: [],
    },
    {
      id: 'policy-assign-metrics',
      name: 'Assign metrics',
      description: 'Description of the Assign metrics Policy',
      icon: '',
      category: 'transformation',
      version: '2.0.1',
      proxy: [],
      message: [],
    },
    {
      id: 'json-xml',
      name: 'JSON to XML',
      description: 'Description of the JSON to XML Transformation Gravitee Policy',
      icon: '',
      category: 'transformation',
      version: '2.1.4',
      proxy: ['RESPONSE', 'REQUEST'],
      message: ['MESSAGE_RESPONSE', 'MESSAGE_REQUEST'],
    },
    {
      id: 'resource-filtering',
      name: 'Resource Filtering',
      description: 'Description of the Resource Filtering Gravitee Policy',
      icon: '',
      category: 'others',
      version: '1.8.1',
      proxy: [],
      message: [],
    },
    {
      id: 'generate-http-signature',
      name: 'Generate HTTP Signature',
      description: 'Description of the Generate HTTP Signature Gravitee Policy',
      icon: '',
      category: 'security',
      version: '1.1.0',
      proxy: [],
      message: [],
    },
    {
      id: 'policy-wssecurity-authentication',
      name: 'WS-Security Authentication',
      description: 'Description of the WS-Security Authentication Gravitee Policy',
      version: '1.0.0',
      proxy: [],
      message: [],
    },
    {
      id: 'mock',
      name: 'Mock',
      description: 'Description of the Mock Gravitee Policy',
      icon: '',
      category: 'others',
      version: '1.13.0',
      proxy: [],
      message: [],
    },
    {
      id: 'metrics-reporter',
      name: 'Metrics Reporter',
      description: 'Description of the Assign metrics Policy',
      icon: '',
      category: 'others',
      version: '2.0.0',
      proxy: [],
      message: [],
    },
    {
      id: 'ssl-enforcement',
      name: 'SSL Enforcement',
      description: 'Description of the SSL Enforcement Gravitee Policy',
      icon: '',
      category: 'security',
      version: '1.2.3',
      proxy: [],
      message: [],
    },
    {
      id: 'jws',
      name: 'JSON Web Signature',
      description: 'Description of the JWS Gravitee Policy',
      icon: '',
      category: 'security',
      version: '1.3.2',
      proxy: [],
      message: [],
    },
    {
      id: 'jwt',
      name: 'JSON Web Tokens',
      description: 'Description of the JWT Gravitee Policy',
      icon: '',
      category: 'security',
      version: '3.2.0',
      proxy: ['REQUEST'],
      message: ['REQUEST'],
    },
    {
      id: 'url-rewriting',
      name: 'URL Rewriting',
      description: 'Description of the URL Rewriting Gravitee Policy',
      icon: '',
      category: 'transformation',
      version: '1.5.0',
      proxy: [],
      message: [],
    },
    {
      id: 'retry',
      name: 'Retry',
      description: 'Description of the Retry Gravitee Policy',
      icon: '',
      version: '2.1.0',
      proxy: [],
      message: [],
    },
    {
      id: 'transform-headers',
      name: 'Transform Headers',
      description: 'Description of the Transform Headers Gravitee Policy',
      icon: '',
      category: 'transformation',
      version: '1.10.0',
      proxy: [],
      message: [],
    },
    {
      id: 'policy-interrupt',
      name: 'Interrupt',
      description: 'Description of the Interrupt Policy',
      category: 'others',
      version: '1.1.0',
      proxy: [],
      message: [],
    },
    {
      id: 'regex-threat-protection',
      name: 'Regex Threat Protection',
      description: 'Description of the RegexThreatProtection Gravitee Policy',
      icon: '',
      category: 'security',
      version: '1.3.3',
      proxy: [],
      message: [],
    },
    {
      id: 'json-to-json',
      name: 'JSON to JSON Transformation',
      description: 'Description of the JSON to JSON Transformation Gravitee Policy',
      icon: '',
      category: 'transformation',
      version: '2.1.0',
      proxy: ['RESPONSE', 'REQUEST'],
      message: ['MESSAGE_RESPONSE', 'MESSAGE_REQUEST'],
    },
    {
      id: 'groovy',
      name: 'Groovy',
      description: 'Description of the Groovy Gravitee Policy',
      icon: '',
      category: 'others',
      version: '2.3.0',
      proxy: [],
      message: [],
    },
    {
      id: 'quota',
      name: 'Quota',
      description: 'Description of the Quota Gravitee Policy',
      icon: '',
      category: 'others',
      version: '2.0.1',
      proxy: [],
      message: [],
    },
    {
      id: 'api-key',
      name: 'API Key',
      description: 'Description of the ApiKey Gravitee Policy',
      icon: '',
      category: 'security',
      version: '3.2.1',
      proxy: ['REQUEST'],
      message: ['REQUEST'],
    },
    {
      id: 'policy-openid-userinfo',
      name: 'OpenID Connect - UserInfo',
      description: 'Description of the OpenID Connect - UserInfo  Gravitee Policy',
      icon: '',
      category: 'security',
      version: '1.5.2',
      proxy: [],
      message: [],
    },
    {
      id: 'transform-queryparams',
      name: 'Transform Query Parameters',
      description: 'Description of the Transform Query Parameters Policy',
      icon: '',
      category: 'transformation',
      version: '1.6.0',
      proxy: [],
      message: [],
    },
    {
      id: 'policy-request-validation',
      name: 'Validate Request',
      description: 'Description of the validate HTTP request Policy',
      icon: '',
      category: 'others',
      version: '1.13.2',
      proxy: [],
      message: [],
    },
  ];
}
